/**
 *   类说明
 * 
 *   @creator         xldc	497937995@qq.com  
 *   @create-time     2014年1月15日   下午7:01:58   
 */
package com.huacheng.cms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huacheng.cms.dao.FriendlyurlMapper;
import com.huacheng.cms.model.Friendlyurl;

@Service
public class FriendlyurlService {

	@Autowired
	private FriendlyurlMapper friendlyurlM;

	public void addOne(Friendlyurl friendlyurl) {
		if (friendlyurl.getSort() == null)
			friendlyurl.setSort(0);
		friendlyurlM.insertSelective(friendlyurl);
	}

	public Friendlyurl getOneByKey(int friendid) {
		return friendlyurlM.selectByPrimaryKey(friendid);
	}

	public int deleteOneByKey(int friendid) {
		return friendlyurlM.deleteByPrimaryKey(friendid);
	}

	public int updateOneByObj(Friendlyurl friendlyurl) {
		return friendlyurlM.updateByPrimaryKeySelective(friendlyurl);
	}

	public int getListCountByObj(Friendlyurl friendlyurl) {
		return friendlyurlM.selectBySelectiveCount(friendlyurl);
	}

	public List<Friendlyurl> getListByObj(Friendlyurl friendlyurl, long offset, long rows) {
		return friendlyurlM.selectBySelective(friendlyurl, offset, rows);
	}
}
